package 贪心;

import java.util.Arrays;

/**
 * @ClassName _455分发饼干
 * @Description TODO
 * @Author 昝亚杰
 * @Date 2021/12/7 20:13
 * Version 1.0
 **/
public class _455分发饼干 {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);//孩子
        Arrays.sort(s);//饼干
        int start = 0,count = 0;
        for(int i = 0; i < s.length && start < g.length; i++){
            if(s[i] >= g[start]){
                start++;
                count++;
            }
        }
        return count;
    }
}
